import request from '@/utils/request'

const api_name = '/admin/edu/teacher'

export default{

  list() {
    return request({
      url: '/admin/edu/teacher/list', // 不传参就不用反引号！！！
      method: 'get'
    })
  },

  pageList(page, limit, searchObj) {
    return request({
      url: `${api_name}/list/${page}/${limit}`, // 传参要用反引号！！！
      method: 'get',
      params: searchObj // 其他参数是由前端的json对象获取的
    })
  },

  removeById(id) {
    return request({
      url: `${api_name}/remove/${id}`, // 传参要用反引号！！！
      method: 'delete'
    })
  },

  save(teacher) {
    return request({
      url: `${api_name}/save`, // 传参要用反引号！！！
      method: 'post',
      data: teacher
    })
  },

  getById(id) {
    return request({
      url: `${api_name}/get/${id}`, // 传参要用反引号！！！
      method: 'get'
    })
  },

  updateById(teacher) {
    return request({
      url: `${api_name}/update`, // 传参要用反引号！！！
      method: 'put',
      data: teacher
    })
  },

  deleteAvatar(url) {
    return request({
      url: `http://localhost:8120/admin/oss/file/delete`,
      method: 'delete',
      params: url
    })
  },

  selectNameListByKey(key) {
    return request({
      url: `${api_name}/list/name/${key}`, // 传参要用反引号！！！
      method: 'get'
    })
  }
}
